//
//  GNRAlertView.h
//  app
//
//  Created by LvYuan on 16/8/18.
//  Copyright © 2016年 UU. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "GNRAlertManager.h"

@class GNRAlertView;

typedef NS_ENUM(NSInteger,ACTION_TYPE)
{
    ACTION_TYPE_SINGLE,//单个功能操作按钮
    ACTION_TYPE_MORE,   //多个功能操作按钮
    ACTION_TYPE_TEXT,   //带有输入框的
    ACTION_TYPE_MONEY,   //输入类型为金额类型
    ACTION_TYPE_UPDATAVERION, //版本更新专用
    ACTION_TYPE_NOHEAD,//无头部
};

typedef void(^callbackAction)(NSInteger idx,id content);
@interface GNRAlertView : UIView

#pragma mark - Public
@property (nonatomic, strong)GNRAlertViewController * alertController;//获取该弹窗的控制器

@property (nonatomic, copy) NSString * title;
@property (nonatomic, copy) NSString * msg;
@property (nonatomic, copy) NSString * cancelBtnTip;

@property (nonatomic,copy)callbackAction  backItemAction;

/**
 提示框风格
 */
@property (nonatomic, assign) GNRAlertStyle    alertStyle;

/**
 按钮排列方式 otherBtns.count大于2时，btnAlignment == GNRAlertBtnAlignmentVertical
 */
@property (nonatomic, assign) GNRAlertBtnAlignment btnAlignment;

/**
 取消按钮位置靠左or靠右 当按钮总数小于3时且btnAlignment横向排列时才可生效
 */
@property (nonatomic, assign) GNRAlertCancelBtnAlignment cancelBtnAlignment;


/**
 弹出风格新
 */
@property (nonatomic,assign)ACTION_TYPE  ALERT_TYPE;


/**输入框最大输入限制*/
@property (nonatomic,assign)CGFloat  MAX_NUMBER;

/**
 点击背景是否可以Dismiss，没有输入框时默认为YES，有输入框此字段无效(考虑到输入框的重要性，故不要轻易消失)
 */
@property (nonatomic, assign) BOOL             dismissOnTapEnable;

/**
 内容标签对齐方式
 */
@property (nonatomic, assign) NSTextAlignment  msgLabelAlignment;

/**
 设置普通按钮正常状态下的文字颜色
 */
@property (nonatomic, strong) UIColor          *otherBtnTintColor;

/**
 高亮文字颜色
 */
@property (nonatomic, strong) UIColor          *hightTextColor;

/**
 弹窗Icon
 */
@property (nonatomic, strong) UIImage          *iconImage;

/**
 弹窗Header
 */
@property (nonatomic, strong) UIImage          *headerBgImage;

/**
 弹窗的标识 设置此字段不会重复弹此标识的弹窗，直至该弹窗消失
 */
@property (nonatomic, strong) NSString             *identifier;


#pragma mark - Text Field Alert
/**
 是否暗文，针对 GNRAlertFieldStyleTextInput 类型
 */
@property (nonatomic, assign) BOOL             secureTextEntry;

/**
 金额上限，必须大于1.0，小于100,000,000.0，针对 GNRAlertFieldStyleMoneyInput 类型
 */
@property (nonatomic, assign) double           upLimitMoney;

/**
 键盘类型 针对 GNRAlertFieldStyleTextInput or GNRAlertFieldStyleLongTextInput
 */
@property (nonatomic, assign) UIKeyboardType   keyboardType;

/**
 输入框默认文字 针对 GNRAlertFieldStyleTextInput or GNRAlertFieldStyleLongTextInput
 */
@property (nonatomic, copy  ) NSString         *placeHolder;

#pragma mark - Count Down Alert
/**
 倒计时，时间最大值 默认30s
 */
@property (nonatomic, assign) NSUInteger       countDownMaxTime;

#pragma mark - Custom Content View
@property (nonatomic, strong) UIView           *customView;


@property (nonatomic, copy) GNRAlertViewActionBlock          actionBlock;
@property (nonatomic, copy) GNRTimeDoneBlock                 timeDoneBlock;
@property (nonatomic, copy) GNRAlertViewTextFieldActionBlock fieldAlertBlock;
@property (nonatomic, copy) GNRLinkActionBlock               linkActionBlock;
@property (nonatomic, copy) GNRInputUpLimitMoneyBlock        inputUpLimitMoneyBlock;




#pragma mark - Method

/**
 *  快捷提示,只有一个确定按钮无需调用show()
 */
+ (void)alertWithTitle:(NSString *)title msg:(NSString *)msg;

/**
 *  普通文本提示框
 */
+ (instancetype)alertWithTitle:(NSString *)title msg:(NSString *)msg cancelBtnTip:(NSString *)cancelBtnTip otherBtnTips:(NSArray *)otherBtnTips actionCallback:(GNRAlertViewActionBlock)callback;


/**
 *  带输入框的提示框
 */
+ (instancetype)alertWithTitle:(NSString *)title alertFieldStyle:(GNRAlertFieldStyle)alertFieldStyle cancelBtnTip:(NSString *)cancelBtnTip otherBtnTips:(NSArray *)otherBtnTips textFieldActionCallback:(GNRAlertViewTextFieldActionBlock)callback;


/**
 *  带定时功能的提示框 时间到 将 alert 对象 回调
 */
+ (instancetype)alertWithTitle:(NSString *)title msg:(NSString *)msg cancelBtnTip:(NSString *)cancelBtnTip otherBtnTip:(NSString *)otherBtnTip actionCallback:(GNRAlertViewActionBlock)callback timeDoneCallback:(GNRTimeDoneBlock)timeDoneCallback;


/**
 *  带有链接形式的提示框
 */
+ (instancetype)alertWithTitle:(NSString *)title linkTip:(NSString *)linkTip cancelBtnTip:(NSString *)cancelBtnTip otherBtnTips:(NSArray *)otherBtnTips actionCallback:(GNRAlertViewActionBlock)callback linkActionBlock:(GNRLinkActionBlock)linkBlock;

/**
 *  自定义内容提示框
 */
+ (instancetype)alertWithTitle:(NSString *)title customView:(UIView *)customView cancelBtnTip:(NSString *)cancelBtnTip otherBtnTips:(NSArray *)otherBtnTips actionCallback:(GNRAlertViewActionBlock)callback;


- (void)show;

- (void)dismiss;

//更新取消按钮文字
- (void)updateCancelBtnTip:(NSString *)cancelBtnTip;

//更新其他按钮文字的数组
- (void)updateOtherBtnTips:(NSArray *)otherBtnTips;

//隐藏/显示 当前AlertView
- (void)gnr_hidden:(BOOL)hidden;

- (void)gnrNew_hidden:(BOOL)hidden;

- (void)dismissWindow;
/**
 2018.5.3新增
 
 @param action_type 类型
 @param title 标题
 @param des 描述
 @param actions 响应
 @return <#return value description#>
 */
- (instancetype)initWithAlertActionType:(ACTION_TYPE)action_type
                                  title:(NSString *)title
                                    des:(NSString *)des
                                actions:(void(^)(NSInteger index,id content))actions;

//显示弹出
- (void)showUU_Alert;


/**传入图片的名称*/
@property (nonatomic,copy)NSString *warningImageStr;

//操作按钮标题文字
@property (nonatomic,strong)NSArray <NSString *>*actionTitleArr;

/**输入框文本*/
@property (nonatomic,copy)NSString *userContent;

@property (nonatomic,copy)NSString *placeHolderContent;

@property (nonatomic,copy)NSString *versionWordStr;

@property (nonatomic,assign) BOOL  isMandatory;//是否强制

/**标题文本颜色*/
@property (nonatomic,copy)NSString *titleTextColor;

/**内容文本颜色*/
@property (nonatomic,copy)NSString *DesTextColor;


@end
